<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      canvas {
        border: 1px solid #ccc;
        margin-right: 5px;
      }
    </style>
  </head>
  <body>
    <script>
      (() => {
        const canvas = document.createElement("canvas");
        canvas.width = 400;
        canvas.height = 400;
        document.body.append(canvas);

        const ctx = canvas.getContext("2d");


        const gradient = ctx.createLinearGradient(0,0,400,0);
        gradient.addColorStop(0,'#f00');
        gradient.addColorStop(0.5,'#0f0');
        gradient.addColorStop(1,'#00f') ;

        ctx.fillStyle = gradient;
        ctx.fillRect(0,0,400,400)


      })();

      (() => {
        const canvas = document.createElement("canvas");
        canvas.width = 400;
        canvas.height = 400;
        document.body.append(canvas);

        const ctx = canvas.getContext("2d");


        const gradient = ctx.createLinearGradient(0,0,400,0);
        gradient.addColorStop(0,'#f00');
        gradient.addColorStop(0.5,'#0f0');
        gradient.addColorStop(1,'#00f') ;

        ctx.fillStyle = gradient;
        ctx.fillRect(100,0,200,400)


      })();

      (() => {
        const canvas = document.createElement("canvas");
        canvas.width = 400;
        canvas.height = 400;
        document.body.append(canvas);

        const ctx = canvas.getContext("2d");


        const gradient = ctx.createLinearGradient(100,0,300,0);
        gradient.addColorStop(0,'#f00');
        gradient.addColorStop(0.5,'#0f0');
        gradient.addColorStop(1,'#00f') ;

        ctx.fillStyle = gradient;
        ctx.fillRect(0,0,400,400)


      })();
      
    </script>
  </body>
</html>
